MCQ
Paper - II (iv) — Programming Fundamentals MCQ - Practice Questions with Answers
Solve 45 Paper - II (iv) — Programming Fundamentals questions for RAS/RPSC preparation.
Practice questions
Q1In a basic blockchain, why does changing data in an earlier block become tamper-evident?
Blockchain records are grouped into blocks that are linked using hash-based identifiers of earlier block data. If data in an older block is altered, its identifier changes, and later blocks that refer to the old value reveal the inconsistency.
Q2In C, what is the value printed by printf("%d", 3 + 4 * 2 == 11 && 0 || 5); assuming the usual integer result of relational and logical operators?
C operator precedence places multiplication above addition, equality below addition, logical AND below equality, and logical OR below logical AND. Thus 3 + 4 * 2 becomes 11, 11 == 11 becomes 1, 1 && 0 becomes 0, and 0 || 5 becomes 1.
Q3Which feature of a blockchain most directly helps detect tampering with an earlier block?
A blockchain connects blocks by storing hash-based references to earlier block data. If an old block is altered, its computed hash changes, so the following block's stored reference no longer matches and the alteration becomes detectable.
Q4A C program declares union Data { int i; float f; char text[20]; }; Which statement is the best reason a union is different from a structure here?
A C structure allocates separate storage for each member, but a union overlays its members in a common storage area large enough for its largest member with required alignment. Therefore it is suitable when exactly one representation is intended to be active at a time.
Q5In C, let `int a[3] = {2, 4, 6}; int *p = a;`. Which expression evaluates to `4` without changing `p`?
In C array expressions commonly provide a pointer to the first element, and pointer arithmetic is scaled by the pointed type. Therefore `p + 1` points to `a[1]`, and `*(p + 1)` reads `4` while leaving `p` unchanged.
You've seen 5 of 45 sample questions
Unlimited practice on Paper - II (iv) — Programming Fundamentals comes with the RAS Test Series + Practice pack or Gate Pass.
More questions
6In C, what is the value of x after executing: int x = 2 + 3 * 4;
7Which statement correctly matches one machine-learning idea with one blockchain idea?
8For a local variable declared inside a C function block, which statement about its scope is correct?
9In C#, which pairing correctly classifies the user-defined types struct Point { public int X; public int Y; } and enum Mode { Read, Write }?
10A Python script is run as python report.py data.csv out.txt. Which statement about sys.argv and file handling is correct?
11A C function is declared as void update(int a[]) { a[0] = 99; }. If int arr[3] = {1, 2, 3}; is passed as update(arr);, what is arr[0] after the call?
12For a Python program run as `python report.py alpha beta`, which statement about command line arguments is correct?
13In C, what is the value of `TUE` in the declaration `enum Day { MON = 1, TUE, WED = 5, THU };`?
14In Python, what is the main purpose of using an `if ... elif ... else` chain instead of three independent `if` statements for mutually exclusive conditions?
15In Java, which statement about variable initialization is correct?
