[go: up one dir, main page]

0% found this document useful (0 votes)
23 views6 pages

Coding Question

The document contains a series of programming questions related to various programming languages, primarily focusing on C and Python. Each question presents a code snippet and multiple-choice answers regarding the expected output or behavior of the code. The questions cover topics such as variable declaration, operator precedence, typecasting, and function behavior.

Uploaded by

Sinchana
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views6 pages

Coding Question

The document contains a series of programming questions related to various programming languages, primarily focusing on C and Python. Each question presents a code snippet and multiple-choice answers regarding the expected output or behavior of the code. The questions cover topics such as variable declaration, operator precedence, typecasting, and function behavior.

Uploaded by

Sinchana
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

QUESTIONS FROM PROGRAMMING LANGUAGES

Ques on 1: What is the output of: int a = 5; prin ("%d", a++);

A) 5
B) 6
C) 4
D) Compila on Error

Ques on 2:What is the output for below wri en code?

int main()

int a=3;

int b=a+++++a+a--;

prin (“b is:%d”,b);

return 0;

A)6

B)5

C)10

D)13

Ques on 3:What is the output for below wri en code?

int main()

int n=5;

int n=10;
prin (“%d”,n);

return 0;

A)5 10 B) 5 C) error D)10

Ques on 4:What is the output for below wri en code?

void main()

int x=5;

int x+=10;

prin (“x:%d”,x);

getch();

A)15 B)10 C)5 D)Error

Ques on 5:What is the output for below wri en code?

public class Test{

public sta c void main(String[] args) {

int a=10;

System.out.println(++a+ a++ +--a);

a)11

b)12

c)29
d)33

Ques on 6:What will be output of this code?

Text=”Python Programming”

Print(text[7:18])

a)Python pro b)Programming c)P Programming d)ython Programming

Ques on 7:What will be output of this code?

num=”5”

result=num+2

a)syntax error b)Logic error c)Type error d) No error

Ques on 8:What will be value of a and b a er this code?

a=3

b=7

a,b=b,a+b

print(a,b)

a)3 7 b)7 10 c)10 7 d)7 3

Ques on 9. What will be the output of the following?

python

a = 10

b = 20

print(a > b and b < a)

(a) True

(b) False

(c) None

(d) Error
Ques on 10:Which of the following declara on is not supported by C language?
a) String str;
b) char *str;
c) float str = 3e2;
d) Both “String str;” and “float str = 3e2;”

Ques on 11: Which of the following typecas ng is accepted by C language?


a) Widening conversions
b) Narrowing conversions
c) Widening & Narrowing conversions
d) None of the men oned

Ques on 12:Where in C the order of precedence of operators do not exist?


a) Within condi onal statements, if, else
b) Within while, do-while
c) Within a macro defini on
d) None of the men oned

Ques on 13:Func ons in C Language are always _________


a) Internal
b) External
c) Both Internal and External
d) External and Internal are not valid terms for func ons
Ques on 14:C preprocessors can have compiler specific features.
a) True
b) False
c) Depends on the standard
d) Depends on the pla orm

Ques on 15:Which of the following is not possible sta cally in C language?


a) Jagged Array
b) Rectangular Array
c) Cuboidal Array
d) Mul dimensional Array

Ques on 16:In C language, FILE is of which data type?


a) int
b) char *
c) struct
d) None of the men oned

Ques on 17:What is the sizeof(char) in a 32-bit C compiler?


a) 1 bit
b) 2 bits
c) 1 Byte
d) 2 Bytes

Ques on 18:Which of the following is not an operator in C?


a) ,
b) sizeof()
c) ~
d) None of the men oned
Ques on 19:What is meant by ‘a’ in the following C opera on?

fp = fopen("Random.txt", "a");

a) A ach
b) Append
c) Apprehend
d) Add

Ques on 20:What will happen if the following C code is executed?

#include <stdio.h>

int main()

int main = 3;

prin ("%d", main);

return 0;

a) It will cause a compile- me error


b) It will cause a run- me error
c) It will run without any error and prints 3
d) It will experience infinite looping

You might also like